package impl;


public class BinaryOrderedArray<K, V> extends AbstractOrderedArray<K, V> {
    public BinaryOrderedArray() {
        super();
    }
    public int search(Object key, int i, int f) {
        if((f-i)>0){
            int id = (f+i)/2;
            int k = A.get(id).getKey().hashCode();
            if(k==key.hashCode()){
                return id;
            }else if(key.hashCode()<k){
                return search(key, i, id-1);
            }else{
                return search(key, id+1, f);
            }
        }else if(!isEmpty() && (A.get(i).getKey().hashCode())==(key.hashCode())){
            return i;
        }
        return -1;
    }
}